# -*- coding = utf-8 -*-
# @time:2022/1/23 15:45
# Author:Leo
# @File:until.py
# @Software:PyCharm
import sys

import os

import yaml

curPath = os.path.abspath(os.path.dirname(__file__))

rootPath = os.path.split(curPath)[0]

sys.path.append(rootPath)


class Until:

    def dumps_yaml(self, file, data):
        with open(mode="w", file=file, encoding="utf-8") as f:
            yaml.safe_dump(data=data, stream=f)

    def read_yaml(self, file):
        with open(file=file, encoding="utf-8", ) as f:
            da = yaml.safe_load(f)
        return da


if __name__ == '__main__':
    data = {
        "a": "1",
        "b": "2"
    }
    data2 = Until().read_yaml("../test_data/user_data.yaml")
    print(data2["add_user"]["user"])
